<!--
 * @Author: Vi卡农
 * @Date: 2020-03-13 16:40:44
 * @LastEditTime: 2020-04-15 15:40:40
 * @Description: -发出的提醒-
 * @FilePath: \cshf_admin\src\views\modules\sys\Emitted.vue
 -->
<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-sys__sysremind}">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
        <el-form-item>
          <el-input v-model="dataForm.id" placeholder="id" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-button @click="getDataList()">{{ $t('query') }}</el-button>
        </el-form-item>
      </el-form>
      <el-table
        v-loading="dataListLoading"
        :data="dataList"
        border
        @selection-change="dataListSelectionChangeHandle"
        style="width: 100%;"
      >
        <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
        <el-table-column prop="id" label="ID" header-align="center" align="center" width="130">
          <template slot-scope="scope">
            <el-button
              type="text"
              @click="goList(scope.row)"
            >{{(scope.row.type==1?"KY - ":"FY - ")+scope.row.moduleId.substring(scope.row.moduleId.length-6)}}</el-button>
          </template>
        </el-table-column>
        <el-table-column prop="type" label="类型" header-align="center" align="center" width="80">
          <template slot-scope="scope">{{$getDictLabel("sysModuleType", scope.row.type)}}</template>
        </el-table-column>
        <el-table-column prop="content" label="提醒内容" header-align="center" align="center"></el-table-column>
        <el-table-column prop="state" label="是否已读" header-align="center" align="center" width="80">
          <template slot-scope="scope">
            <span v-if="scope.row.state==1" class="Alreadyread">已读</span>
            <span v-else class="svgColor2">未读</span>
          </template>
        </el-table-column>

        <el-table-column prop="solve" label="是否解决" header-align="center" align="center" width="80">
          <template slot-scope="scope">
            <span v-if="scope.row.solve==1" class="Alreadyread">是</span>
            <span v-else class="svgColor2">否</span>
          </template>
        </el-table-column>

        <el-table-column
          prop="userName"
          label="接收人"
          header-align="center"
          align="center"
          width="100"
        ></el-table-column>
        <el-table-column
          prop="creatorName"
          label="发送人"
          header-align="center"
          align="center"
          width="120"
        ></el-table-column>
        <el-table-column
          prop="deptName"
          label="发送人部门"
          header-align="center"
          align="center"
          width="120"
        ></el-table-column>
         <el-table-column
          prop="oldUserName"
          label="原归属人"
          header-align="center"
          align="center"
          width="120"
        ></el-table-column>
        <el-table-column
          prop="createDate"
          label="发送时间"
          header-align="center"
          align="center"
          width="180"
        ></el-table-column>

        <el-table-column
          :label="$t('handle')"
          fixed="right"
          header-align="center"
          align="center"
          width="150"
        >
          <template slot-scope="scope">
            <!-- <el-button
              v-if="$hasPermission('sys:sysremind:update')"
              type="text"
              size="small"
              @click="addOrUpdateHandle(scope.row.id)"
            >{{ $t('update') }}</el-button>-->
            <el-button
              v-if="$hasPermission('sys:sysremind:delete')"
              type="text"
              size="small"
              @click="deleteHandle(scope.row.id)"
            >{{ $t('delete') }}</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="ZWbox"></div>
      <div class="paginationBox">
        <el-pagination
          :current-page="page"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="limit"
          :total="total"
          layout="total, sizes, prev, pager, next, jumper"
          @size-change="pageSizeChangeHandle"
          @current-change="pageCurrentChangeHandle"
        ></el-pagination>
      </div>
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from "@/mixins/view-module";
export default {
  mixins: [mixinViewModule],
  data() {
    return {
      mixinViewModuleOptions: {
        getDataListURL: "/sys/sysremind/sendPage",
        getDataListIsPage: true
      },
      dataForm: {
        id: this.$route.query.ID ? this.$route.query.ID : ""
      }
    };
  },
  created() {},
  methods: {
    //跳转到列表页
    goList(row) {
      if (row.type == 2) {
        this.$router.push({
          name: "house-houseinfo",
          query: {
            moduleId: row.moduleId
          }
        });
      } else if (row.type == 1) {
        this.$router.push({
          name: "customer-customerhouseinfo",
          query: {
            moduleId: row.moduleId
          }
        });
      }
    }
  }
};
</script>
